#include "stm32f10x.h"                  // Device header
#include "Delay.h"
#include "OLED.h"
#include "USART1.h"
#include "LED.h"
#include "string.h"




int main(void)
{ 
	OLED_Init();
  USART1_Init();
	LED_Init();
	OLED_ShowString(1,1,"TxPacket:");
	OLED_ShowString(3,1,"RxPacket:");

	
	while(1)
 {
	if(RxFlag==1)
  {
		OLED_ShowString(4, 1, "                ");
		OLED_ShowString(4,1,RxPacket);
		
		if(strcmp(RxPacket,"LED_ON")==0)
    {
			LED_ON_GREEN();
			USART1_SendString("LED_ON_OK\r\n");
			OLED_ShowString(2, 1, "                ");
		  OLED_ShowString(2,1,"LED_ON_OK");
		}
		else if(strcmp(RxPacket,"LED_OFF")==0)
    {
			LED_OFF_GREEN();
			USART1_SendString("LED_OFF_OK\r\n");
			OLED_ShowString(2,1,"                ");
		  OLED_ShowString(2,1,"LED_OFF_OK");
		}
		else
    {
			USART1_SendString("ERROR\r\n");
			OLED_ShowString(2,1,"                ");
		  OLED_ShowString(2,1,"ERROR");
		}
		RxFlag=0;
	}
 }
 
}
